(function(d){
  var html = d.getElementsByTagName('html')[0];  // html节点
  var resizeEvent = 'orientationchange' in window ? 'orientationchange' : 'resize';
  function getScale() {
    var width = html.clientWidth, // 设备宽度
        dpr = window.devicePixelRatio, // 像素比
        scale = Number(width/750).toFixed(4),  //  320：0.427   768：1.024
        lastScale = scale>1.024?1.024:(scale<0.427?0.427:scale);
    return lastScale;
  }
  var changePage = function(e) {
    var lastScale = getScale();
    if ( html.clientWidth <= 768 ) {
      html.setAttribute('style','font-size:'+(lastScale*100).toFixed(3)+'px');
    } else {
      html.setAttribute('style','')
    }
  }
  changePage();
  if (!document.addEventListener) return;
  window.addEventListener(resizeEvent, changePage, false);  // 监听设备屏幕旋转/页面resize
  document.addEventListener('DOMContentLoaded', changePage, false); // 监听刷新页面
})(document);


$('.phone-nav').click(function(event) {
  $('.phone-nav').addClass('active');
  $(this).removeClass('active');
  $(".nav ul").slideToggle("slow");
});
